﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NHibernate;
using DotNet.Common.NHibernateUtil;
using ZLCMS.Data.Model;
using NHibernate.Criterion;
using ZLCMS.Web.Wap.Code;
using ZLCMS.Business.Util;
using System.Security.Cryptography;
using System.Text;
using Newtonsoft.Json;

namespace ZLCMS.Web.Wap.Shop
{
    public partial class FormDisplay : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            ViewState["FormId"] = Int32.Parse(Request["formid"]);
            using (ISession session = SessionFactoryHelper.CreateSession())
            {
                FormDef = session.Get<SysFormDef>(ViewState["FormId"]);
                JsonData = JsonConvert.SerializeObject(session.CreateQuery("from SysFormField where FormId=:fid order by Sort")
                    .SetParameter("fid", ViewState["FormId"])
                    .List<SysFormField>());
            }
        }

        public SysFormDef FormDef { get; set; }

        public string Image
        {
            get
            {
                return FileKit.FirstFilePath(FormDef.ImageUrl);
            }
        }

        public string JsonData { get; set; }

    }
}